package com.icangya.DAO.impl;

import com.icangya.DAO.IFbMissionAwardDAO;
import com.icangya.domain.FbMissionAward;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Repository;

import java.util.List;


@Repository
public class FbMissionAwardDAOImpl extends BaseDAO<FbMissionAward> implements IFbMissionAwardDAO {

    Logger logger = LoggerFactory.getLogger(this.getClass());

    @Override
    public List<FbMissionAward> getMissionAwardByStatus(int site) {
        String hql="FROM FbMissionAward ma where  ma.site=?";

        List<FbMissionAward> list= (List<FbMissionAward>) getHibernateTemplate().find(hql,site);
        if(list.size()>0){
            return list;
        }
        return null;
    }

    @Override
    public List<FbMissionAward> getMissionAward() {
        String hql="FROM FbMissionAward ma";

        return (List<FbMissionAward>) getHibernateTemplate().find(hql);
    }

    @Override
    public List<FbMissionAward> getMissionAwardStatus(int site) {
        String hql="FROM FbMissionAward ma where ma.status=0 and ma.site=?";

        List<FbMissionAward> list= (List<FbMissionAward>) getHibernateTemplate().find(hql,site);
        if(list.size()>0){
            return list;
        }
        return null;
    }
}
